Skip to content

workshop content#4

Open
rakadityas wants to merge 1 commit intotherizk:masterfrom
rakadityas:workshop
Open

workshop content#4
rakadityas wants to merge 1 commit intotherizk:masterfrom
rakadityas:workshop

Conversation

@rakadityas
Copy link

No description provided.


const (
// Collection queries
QueryGetNilaiSiswaByID = `select nim, mapel_id, nilai, sekolah, kelas
Copy link
Author

@rakadityas rakadityas Dec 17, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

coalescenya jangan lupa yaa, takutnya kalo null bisa geser nanti atributenya

type NilaiSiswa struct {
NIM int64 `json:"nim" db:"nim"`
MapelID int64 `json:"mapel_id" db:"mapel_id"`
Nilai int64 `json:"nili" db:"nili"`
Copy link
Author

@rakadityas rakadityas Dec 17, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

typo yaaa nili

Nilai int64 json:"nili" **db:"nili"**


resp = mappingGetNilaiSiswa(nilai, detailSekolah)
}

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

untuk mappingGetNilaiSiswa() dan nilai.GetDetailSekolah(), mungkin bisa dikeluarin dari if nya, karena rada redundan

Copy link
Author

@rakadityas rakadityas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unit testnya masih belum ada ya?

req.sekolah = "semua"
}

nilai, err := mnilai.GetNilaiSiswa(req.nim, req.sekolah, req.kelas, mapel_id)
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

btw pak, untuk nama variablenya mungkin bisa distandarin, jangan pakai underscore mapel_id

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hmm mapel_id ini dari mana ya 🤔

}

resp = mappingGetNilaiSiswa(nilai, detailSekolah)
} else if sekolah != "semua" {
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

constant ini sepertinya dipake berulang ulang, mungkin bisa dibuat constant, supaya kalau berubah satu berubah semua

return resp, errors.AddTrace(err)
}

detailSekolah, err := nilai.GetDetailSekolah(ctx, nilai.Sekolah[0])
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

indexnya sepertinya perlu dicek dulu, takutnya nil

"github.com/tokopedia/tokopoints/tracer"
)

func GetNilaiSiswa(ctx context.Context, nim int64, sekolah, kelas string, mapel_id int64) (resp GetNilaiSiswaResponse, err error) {
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

mungkin paramnya bisa dibuat struct supaya ga kepanjangan

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants